package com.sys.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sys.dao.LoginDao;
import com.sys.entity.Administrator;
import com.sys.entity.Student;
import com.sys.entity.Teacher;
import com.sys.service.LoginService;
@Service
public class LoginServiceImpl implements LoginService {
	@Autowired
	private LoginDao loginDao;
	@Override
	public Map<String, Object> getAll(String phone, String password) {
		Map<String, Object> panams = new HashMap<String, Object>();
		panams.put("phone", phone);
		panams.put("password", password);
		
		List<Administrator> adminList = loginDao.getAllAdministrator(panams);
		List<Student> stuList = loginDao.getAllStudent(panams);
		List<Teacher> teaList = loginDao.getAllTeacher(panams);
		
		Map<String, Object> map = new HashMap<String, Object>();
		if (adminList.size() > 0 && adminList != null) {
			map.put("list", adminList);
		}
		if (stuList.size() > 0 && stuList != null) {
			map.put("list", stuList);
		}
		if (teaList.size() > 0 && teaList != null) {
			map.put("list", teaList);
		}
		return map;
	}

}
